<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_users
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
?>
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
	// Get a db connection.
	$db = JFactory::getDbo();
	// Create a new query object.
	$query  = $db->getQuery(true);
	$user   = & JFactory::getUser();
	$uid  	= $user->get('id');
	// Select all records from the user profile table where key begins with "custom.".
	// Order it by the ordering field.
	$query
    ->select(array('a.title', 'b.user_id','b.group_id'))
    ->from('#__usergroups AS a')
    ->join('INNER', '#__user_usergroup_map AS b ON (a.id = b.group_id)')
    ->where('b.user_id='.$uid);
	// Reset the query using our newly populated query object.
	$db->setQuery($query);
	$results = $db->loadObjectList();
	foreach($results as $row){
		$title = $row->title;
	}
?>
<?php if($title=='Clients'){?>
<div class="control-group">
    <div class="controls">
        <label for="1group_10" class="checkbox">
        <input type="checkbox" rel="1group_6" checked="checked" id="1group_10" value="10" name="jform[groups][]">
        <span class="gi">|&mdash;</span><span class="gi">|&mdash;</span>Clients
        </label>
    </div>
</div>
<?php } elseif($title=='Administrator'){?>
<div class="control-group">
    <div class="controls">
        <label for="1group_12" class="checkbox">
        <input type="checkbox" rel="1group_6" checked="checked" id="1group_12" value="12" name="jform[groups][]">
        <span class="gi">|&mdash;</span><span class="gi">|&mdash;</span>Client
        </label>
    </div>
</div>
<?php }elseif($title == 'Admin'){ ?>
<div class="control-group">
    <div class="controls">
        <label for="1group_12" class="checkbox">
        <input type="checkbox" rel="1group_6" checked="checked" id="1group_12" value="12" name="jform[groups][]">
        <span class="gi">|&mdash;</span><span class="gi">|&mdash;</span>Client
        </label>
    </div>
</div>
<div class="control-group">
    <div class="controls">
        <label for="1group_10" class="checkbox">
        <input type="checkbox" rel="1group_6" id="1group_10" value="10" name="jform[groups][]">
        <span class="gi">|&mdash;</span><span class="gi">|&mdash;</span>Managers
        </label>
    </div>
</div>
<?php }else{?>
<?php echo JHtml::_('access.usergroups', 'jform[groups]', $this->groups, true); ?>
<?php } ?>
